import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
export const useCountStore = defineStore(
  'count',
  () => {
    const count = ref(0)
    const obj = ref({ name: 'zs' })
    const pow = computed(() => {
      return count.value ** 2
    })

    const addCount = () => {
      count.value++
    }
    const cutCount = () => {
      count.value--
    }
    const objChange = () => {
      obj.value.name += 'z'
    }
    return { count, objChange, addCount, cutCount, pow, obj }
  },
  {
    persist: {
      paths: ['count']
    }
  }
)
